// 封装分类相关的接口函数
import request from '@/utils/request'

// 获取分类列表
export function getCategory(params) {
  return request({
    url: '/categories',
    params
  })
}

// 添加分类
export function addCategory(data) {
  return request({
    url: '/categories',
    method: 'post',
    data: data
  })
}

// 编辑回显
export function echoCategory(id) {
  return request({
    url: '/categories/' + id
  })
}

// 编辑
export function editCategory(data) {
  return request({
    url: '/categories/' + data.id,
    method: 'put',
    data
  })
}

// 删除
export function delCategory(id) {
  return request({
    url: '/categories/' + id,
    method: 'delete'
  })
}

// 筛选
export function screenAgent(params) {
  return request({
    url: '/categories',
    params: {
      title_contains: params
    }
  })
}

// 分页数量
export function pageCount(params) {
  return request({
    url: '/categories/count',
    params
  })
}

